import Cookies from 'js-cookie'
import { tokenKey } from '../settings'

/**
 * 获取 token
 * @returns String
 */
export function getToken() {
  return Cookies.get(tokenKey)
}

/**
 * 设置 token
 * @param {String} token
 * @returns String
 */
export function setToken(token) {
  return Cookies.set(tokenKey, token)
}

/**
 * 设置1.0的token
 * @param token
 * @returns {*}
 */
export function setToken10(token) {
  window.sessionStorage.setItem('china-tower-token-pms10', token)
}
/**
 * 获取1.0的token
 * @returns {*}
 */
export function getToken10() {
  window.sessionStorage.getItem('china-tower-token-pms10')
}
/**
 * 移除 token
 * @returns
 */
export function removeToken() {
  return Cookies.remove(tokenKey)
}
